function SuperType(str){
  console.log('used')
  this.str = str??'none'
  this.arr = [1,2,3]
  this.fn = ()=>console.log(1)
}
const superType = new SuperType('superType')
console.log(superType)

function SubType (num){
  this.num = num
  SuperType.call(this)
}
SubType.prototype = new SuperType()
SubType.prototype.constuctor = SubType

/**
 * 优点：父类的方法可以共享
 * 父类的引用属性不会被共享
 * 子类构建实例时可以向父类传递参数
 * 缺点：调用了两次父类的构造函数
 */


const subType = new SubType()
console.log(subType)